﻿using System.Collections.Generic;
using System.Data;
using System;

namespace OracleDal.Topo
{
    /// <summary>
    /// 数据访问类CHANNEL。
    /// </summary>
    public class CHANNEL
    {
        private readonly OracleDAL.Common.mysqldata dal = new OracleDAL.Common.mysqldata();
        /// <summary>
        /// 
        /// </summary>
        public CHANNEL()
        { }
        #region  成员方法
        /// <summary>
        /// 得到基站信道占用实例
        /// </summary>
        /// <param name="NEID">基站ID</param>
        /// <returns></returns>
        public Model.Topo.CHANNEL GetModel(string NEID)
        {
            return new Model.Topo.CHANNEL();
        }
        /// <summary>
        /// 获取基站信道占用列表
        /// </summary>
        /// <param name="NEID">基站ID</param>
        /// <returns></returns>
        public List<Model.Topo.CHANNEL> GetModelList(string NEID)
        {
            List<Model.Topo.CHANNEL> modelList = new List<Model.Topo.CHANNEL>();
            Model.Topo.CHANNEL model;
            string[,] str = new string[2, 2] { { "p_neid", "string" }, { "p_belongdxt", "string" } };
            string[] v = new string[] { NEID, "" };
            DataSet ds = dal.GetList("get_tbs_channel", str, v);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                int length = ds.Tables[0].Rows.Count;
                for (int i = 0; i < length; i++)
                {
                    model = new Model.Topo.CHANNEL();
                    model.NEID = ds.Tables[0].Rows[i]["NEID"].ToString();
                    model.EQUIPNAME = ds.Tables[0].Rows[i]["CHINA_NAME"].ToString();
                    model.BELONGDXT = ds.Tables[0].Rows[i]["NEID"].ToString();
                    model.TSL0 = ds.Tables[0].Rows[i]["TSL0"].ToString();
                    model.TSL1 = ds.Tables[0].Rows[i]["TSL1"].ToString();
                    model.TSL2 = ds.Tables[0].Rows[i]["TSL2"].ToString();
                    model.TSL3 = ds.Tables[0].Rows[i]["TSL3"].ToString();
                    model.DXTTSL0 = ds.Tables[0].Rows[i]["DXT_TSL0"].ToString();
                    model.DXTTSL1 = ds.Tables[0].Rows[i]["DXT_TSL1"].ToString();
                    model.DXTTSL2 = ds.Tables[0].Rows[i]["DXT_TSL2"].ToString();
                    model.DXTTSL3 = ds.Tables[0].Rows[i]["DXT_TSL3"].ToString();
                    model.UNIT = ds.Tables[0].Rows[i]["UNIT"].ToString();
                    model.TIMESTAMP = ds.Tables[0].Rows[i]["TIME_STAMP"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }
        /// <summary>
        /// 获取数据集
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        /// <returns></returns>
        public DataSet GetList(string strWhere)
        {
            DataSet ds = new DataSet();
            return ds;
        }
        //public  public DataSet GetList(string PRODUCENAME, string[,] PARAM, string[] VALUES)
        //{
        //    return OracleDAL.GetList(PRODUCENAME, PARAM, VALUES);
        //}
        /// <summary>
        /// 获取基站信道占用列表
        /// </summary>
        /// <param name="NEID">基站ID</param>
        ///  <param name="DXT">交换机ID</param>
        /// <returns></returns>
        public DataSet GetMainChanelList(string NEID, string DXT)
        {
            string[,] str = new string[2, 2] { { "p_neid", "string" }, { "p_belongdxt", "string" } };
            string[] v = new string[] { NEID, DXT };
            DataSet ds = dal.GetList("get_tbs_main_channel", str, v);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                return ds;
            }
            return null;
        }
       /// <summary>
        /// 获取基站信道上行占用率排行表
       /// </summary>
       /// <param name="TOP">获取TOP数量</param>
       /// <param name="strWhere">查询条件(一般为列表)</param>
       /// <returns></returns>
        public DataSet GetMainChanelUplinkList(string TOP, string strWhere)
        {
            string[,] str = new string[2, 2] { { "p_topcount", "int" }, { "p_strwhere", "string" } };
            string[] v = new string[] { (TOP == "" ? "0" : TOP), strWhere };
            DataSet ds = dal.GetList("GET_TBS_MAIN_CHANEL_UPLINK_TOP", str, v);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                return ds;
            }
            return null;
        }
       /// <summary>
        /// 获取基站信道下行占用率排行表
       /// </summary>
       /// <param name="TOP">获取TOP数量</param>
       /// <param name="strWhere">查询条件(一般为NEID列表)</param>
       /// <returns></returns>
        public DataSet GetMainChanelDownlinkList(string TOP, string strWhere)
        {
            string[,] str = new string[2, 2] { { "p_topcount", "int" }, { "p_strwhere", "string" } };
            string[] v = new string[] { (TOP == "" ? "0" : TOP), strWhere };
            DataSet ds = dal.GetList("GET_TBS_MAIN_CHANEL_DOWNLINK_TOP", str, v);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                return ds;
            }
            return null;
        }
        /// <summary>
        /// 获取基站信道占用率时刻表
        /// </summary>
        /// <param name="TOP">取排行数量</param>
        /// <param name="NEID">基站ID</param>
        /// <returns></returns>
        public DataSet GetMainChanelLinkList(string TOP, string NEID)
        {
            string[,] str = new string[2, 2] { { "p_topcount", "int" }, { "p_neid", "string" } };
            string[] v = new string[] { (TOP == "" ? "0" : TOP), NEID };
            DataSet ds = dal.GetList("GET_TBS_MAIN_CHANEL_LINK", str, v);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                return ds;
            }
            return null;
        }
        #endregion
    }
}
